package com.ihisun.tmhcms.controller.syscontroller;

import com.ihisun.tmhcms.core.dto.agreementdto.AgreementDto;
import com.ihisun.tmhcms.core.dto.housekeeperdto.EditHousekeeperDto;
import com.ihisun.tmhcms.core.dto.housekeeperdto.SearchHousekeeperDto;
import com.ihisun.tmhcms.core.dto.withdrawalsettingsdto.EditWithdrawalSettingsDto;
import com.ihisun.tmhcms.core.service.agreementservice.AgreementService;
import com.ihisun.tmhcms.core.service.housekeeperservice.HousekeeperService;
import com.ihisun.tmhcms.core.service.machanismservice.MachanismService;
import com.ihisun.tmhcms.core.service.withdrawalsettingsservice.WithdrawalSettingsService;
import com.ihisun.tmhcms.core.vo.AgreementVo;
import com.ihisun.tmhcms.core.vo.HousekeeperVo;
import com.ihisun.tmhcms.core.vo.MechanismVo;
import com.ihisun.tmhcms.utils.ResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@Api(tags = "系统相关Api")
@RestController
@RequestMapping("/sysSize")
public class SysController {
    @Resource
    WithdrawalSettingsService withdrawalSettingsService;
    @Resource
    MachanismService machanismService;
    @Resource
    HousekeeperService housekeeperService;
    @GetMapping("/withdrawalSize")
    @ApiOperation(value = "提现设置")
    public ResponseVo withdrawalSize(@RequestBody EditWithdrawalSettingsDto editWithdrawalSettingsDto){
        return withdrawalSettingsService.editWithdrawalSize(editWithdrawalSettingsDto);
    }
    @GetMapping("/echoWithdrawalSize")
    @ApiOperation(value = "提现设置回显")
    public ResponseVo echoWithdrawalSize(){
        return withdrawalSettingsService.echoWithdrawalSize();
    }



    @Resource
    AgreementService agreementService;

    @GetMapping("/echoAgreement")
    @ApiOperation(value = "回显协议", response = AgreementVo.class)
    public ResponseVo echoAgreement() {

        return agreementService.echoAgreement();
    }

    @PostMapping("/editAgreement")
    @ApiOperation(value = "编辑协议")
    public ResponseVo editAgreement(@RequestBody AgreementDto agreementDto) {
        return agreementService.editAgreement(agreementDto);
    }
    @GetMapping("/findByNoMechanism")
    @ApiOperation(value = "查询所有未关联的机构",response = MechanismVo.class)
    public  ResponseVo findByNoMechanism(){
       return machanismService.findByNoMechanism();
    }

    @GetMapping("/findByMechanism")
    @ApiOperation(value = "查询已经关联的机构",response =MechanismVo.class )
    @ApiImplicitParam(name = "keeperId",value = "管家id",dataType = "String", paramType = "query")
    public ResponseVo findByMechanism(String keeperId){
        return machanismService.findByMechanism(keeperId);
    }




    @PostMapping("/searchKeeper")
    @ApiOperation(value = "医美管家列表",response = HousekeeperVo.class)
    public ResponseVo searchHousekeeper(@RequestBody SearchHousekeeperDto searchHousekeeperDto){
        ResponseVo responseVo = housekeeperService.searchHousekeeper(searchHousekeeperDto);
        return responseVo;
    }

    @PostMapping("/editHousekeeper")
    @ApiOperation(value = "编辑医美管家")
    public ResponseVo editHousekeeper(@RequestBody EditHousekeeperDto editHousekeeperDto){
        ResponseVo responseVo = housekeeperService.editHousekeeper(editHousekeeperDto);
        return responseVo;
    }

    @GetMapping("/deleteHousekeerper")
    @ApiOperation(value = "删除医美管家")
    @ApiImplicitParams({
            @ApiImplicitParam(name="keeperId" ,value = "管家Id", dataType = "String",paramType = "query"),

    })
    public ResponseVo deleteHousekeerper(String keeperId){
        return housekeeperService.deleteHousekeerper(keeperId);
    }
}
